package org.example.controller;

import org.example.dto.LoginDto;
import org.example.service.SysUserService;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.Map;

@RestController
@RequestMapping("/login")
public class LoginController {

    @Resource
    private SysUserService sysUserService;

    /**
     * 前端使用的是 axios, axios除了GET请求，其余的 Content-Type application/json
     */
    @PostMapping
    public Map<String, Object> login(@RequestBody LoginDto loginDto) {
        return sysUserService.login(loginDto);
    }
}
